package pl.org.lutra.planner.log;

import java.lang.Thread.UncaughtExceptionHandler;

public class Log {
	private static final Logger LOGGER = LoggerFactory.createLogger();

	static {
		Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionHandler() {
			@Override
			public void uncaughtException(Thread t, Throwable exception) {
				Log.error("Uncaught exception", exception);
			}
		});
	}

	public static void error(Throwable exception) {
		LOGGER.error(null, exception);
	}

	public static void error(String message, Throwable exception) {
		LOGGER.error(message, exception);
	}

	public static void warning(Throwable exception) {
		LOGGER.warning(null, exception);
	}

	public static void warning(String message, Throwable exception) {
		LOGGER.warning(message, exception);
	}

	public static void info(Throwable exception) {
		LOGGER.info(null, exception);
	}

	public static void info(String message, Throwable exception) {
		LOGGER.info(message, exception);
	}

	public static void debug(String message) {
		LOGGER.debug(message, null);
	}

	public static void debug(Throwable exception) {
		LOGGER.debug(null, exception);
	}

	public static void debug(String message, Throwable exception) {
		LOGGER.debug(message, exception);
	}

}
